﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Portal.Presentation.Models
{
	public class DashboardViewModel
	{
		private readonly List<DashboardWarning> _warnings;

		#region Properties
		/// <summary>
		/// Gets or sets the warnings.
		/// </summary>
		/// <value>
		/// The warnings.
		/// </value>
		public IEnumerable<DashboardWarning> Warnings
		{
			get { return _warnings; }
		}
		#endregion

		#region .ctor
		/// <summary>
		/// Initializes a new instance of the <see cref="DashboardViewModel"/> class.
		/// </summary>
		public DashboardViewModel()
		{
			_warnings = new List<DashboardWarning>();
		}
		#endregion

		#region Methods
		/// <summary>
		/// Adds the specified warning.
		/// </summary>
		/// <param name="warning">The warning.</param>
		public void Add(DashboardWarning warning)
		{
			if (warning != null)
			{
				_warnings.Add(warning);
			}
		}

		/// <summary>
		/// Adds the warning.
		/// </summary>
		/// <param name="header">The header.</param>
		/// <param name="message">The message.</param>
		/// <param name="controller">The controller.</param>
		/// <param name="action">The action.</param>
		internal void AddWarning(string header, string message, string controller, string action)
		{
			Add(new DashboardWarning()
			{
				Header = header,
				Message = message,
				Controller = controller,
				Action = action
			});
		}

		#endregion
	}
}